<!-- 个人中心 -->
<template>
	<view class="container">
		<view class="title_box">
			<view @click="clickItem(item.id)" v-for="(item, i) in titleList" :key="i">
				<view style="position: relative;display: flex;">
				<view class="dian" v-if="handleitem==item.id"></view>
				<view :class="item.id==handleitem?'name':'noname'">{{item.name}}</view>
				</view>
			</view>
		</view>
		<view class="share-list" v-for="(item, i) in shareList" :key="item.id">
			<view  class="shareBox">
				<view style="width: 10%;"><image style="width: 40rpx;height: 40rpx;" :src="item.avatar"></image></view>
				<view style="display: flex;flex-direction: column;width: 90%;">
					<view class="share-name">{{item.nickname}}</view>
					<view class="share-content">{{item.remarks}}</view>
					<view class="share-br"></view>
					<view style="display: flex;margin-top: 10rpx;justify-content: space-between;">
						<view class="share-time">{{item.time}}</view>
						<view class="share-fangshi" v-if="item.type == 1">来自商品分享</view>
						<view class="share-fangshi" v-else-if="item.type == 2">来自资讯分享</view>
						<view class="share-fangshi" v-else-if="item.type == 3">来自咨询分享</view>
						<view class="share-fangshi" v-else-if="item.type == 4">来自培训|分享</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				handleitem:'',
				titleList:[
					{
						id:'',
						name:'全部'
					},
					{
						id:'1',
						name:'商品'
					},
					{
						id:'2',
						name:'资讯'
					},
					{
						id:'3',
						name:'拼团'
					},
				],
				shareList: [
					]
			};
		},
        mounted() {
            this.getShareData()
        },
		methods: {
			clickItem(val){
				console.log("111",val)
				this.handleitem=val
				this.getShareData()
			},
            getShareData() {
            	let that = this
            	that.$api.shareList({
            		type: this.handleitem
            	}).then(res => {
            		console.log('res', res)
            		if (res.code == 1) {
            			 this.shareList= res.data
            		}
            	});
            },
		}
	};
</script>

<style lang="scss" scoped>
	* {
		box-sizing: border-box;
		margin: 0;
		padding: 0;
	}
	.container{
		background: #F5F5F5;
		height: 100vh;
		padding: 34rpx 30rpx 33rpx 30rpx;
	}

	.title_box{
		display: flex;
		// justify-content: space-between;
		justify-content: space-around;
	}
	.name{
		font-size: 32rpx;
		font-family: Source Han Sans CN;
		font-weight: bold;
		color: #333333;
		// position: absolute;
		    width:70rpx;
		    left: 20rpx;
		    top: 0rpx;
			z-index: 9;
	}
	
	.dian{
		background-size: 100% 100%;
		width: 35rpx;
		height: 35rpx;
		background-image: url('/static/image/fenxiao26.png');
		    position: absolute;
		   top: -5px;
		       left: -7px;
	}
	.noname{
		font-size: 30rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #333333;
		z-index: 9;
	}
	.shareBox{
		height: 190rpx;
		background: #FFFFFF;
		border-radius: 28rpx;
		display: flex;
		margin-top: 30rpx;
		padding:25rpx 25rpx 10rpx 25rpx;
	}
	.share-name{
		font-size: 28rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #999999;
		flex: 1;
	}
	.share-content{
		font-size: 28rpx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		color: #333333;
		flex: 1;
		  
	}
	.share-br{
		  border: 1px solid #F2F2F2;
	}
		
	.share-time{
		font-size: 24rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #CCCCCC;
	}
	.share-fangshi{
		font-size: 24rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #CCCCCC;
	}
</style>
